﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace PMKB_DAL
{
    partial class Link : IValidatableObject
    {
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            var validationResults = new List<ValidationResult>();
            if (string.IsNullOrEmpty(this.LinkDescription))
                validationResults.Add(new ValidationResult(PMKBEntities_resource.Link_LinkDescription_Required,new string[1]{ Link_List.FieldNames.LinkDescription}));

            if (string.IsNullOrEmpty(this.LinkName))
                validationResults.Add(new ValidationResult(PMKBEntities_resource.Link_LinkName_Required, new string[1] { Link_List.FieldNames.LinkName}));

            if (string.IsNullOrEmpty(this.LinkUrl))
                validationResults.Add(new ValidationResult(PMKBEntities_resource.Link_LinkUrl_Required, new string[1] { Link_List.FieldNames.LinkUrl}));

            return validationResults;
            //return Utils.ShowError<Link>(this);
        }
    }
}
